package com.itheima.springbootinittest10.pojo;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component //表示person被spring识别，是个bean
//@ConfigurationProperties //person对象从配置文件中获取一级属性
@ConfigurationProperties(prefix = "person")//person对象从配置文件中获取2级属性 prefix表示2级key是啥
public class Person {
    private String name;
    private Integer age;
    private String[] address;

    public Person() {
    }

    public Person(String name, Integer age,String[] address) {
        this.name = name;
        this.age = age;
        this.address=address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String[] getAddress() {
        return address;
    }

    public void setAddress(String[] address) {
        this.address = address;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
